<?php

class Form_Strain extends Form
{
	public function Form_Strain($strain)
	{
		parent::__construct();
		
		$this->Name = 'modify_strain';
		$this->Title = 'Modify Weed Strain';

		// section 1
		$section = a2o( 'FormSection', array( 'Name' => 'modify_strain_general', 'Title' => 'General' ) );
		$this->Controls[] = $section;
		
		// add controls to section
		$section->Controls[] = a2o( 'FormControl', array( 'Bean' => $strain, 'FieldName' => 'Name', 'Title' => 'Name', 'Template' => 'templates/FormControlText.tpl' ) );
		$section->Controls[] = a2o( 'FormControl', array( 'Bean' => $strain, 'FieldName' => 'Category', 'Title' => 'Category', 'Template' => 'templates/FormControlText.tpl' ) );
		$section->Controls[] = a2o( 'FormControl', array( 'Bean' => $strain, 'FieldName' => 'Potency', 'Title' => 'Potency', 'Template' => 'templates/FormControlText.tpl' ) );
		$section->Controls[] = a2o( 'FormControl', array( 'Bean' => $strain, 'FieldName' => 'GrowTime', 'Title' => 'Grow Time', 'Template' => 'templates/FormControlText.tpl' ) );
		$section->Controls[] = a2o( 'FormControl', array( 'Bean' => $strain, 'FieldName' => 'Description', 'Title' => 'Description', 'Template' => 'templates/FormControlText.tpl' ) );
		
		if(count($_POST) > 0)
		{
			$this->LoadPostData();
			R::store($strain);
		}
	}
}
